layui.use(['form','laypage','layer'],function(){
	
	var form = layui.form
	,layer = layui.layer;
	
	var runStatus = {"1":"待执行","2":"执行中","3":"成功","4":"失败"};
	 initPage();
	  
	  
	  
	  function initPage(){
		  
		  var taskId = $("#taskId").val();
		  ajaxPost("../caseRun/list",{taskId:taskId},
				  function(data){
			  		createData(data.data);
		  		},
				  function(data){
					  layer.alert(data.errorMsg,{
							icon:5,
							title:"错误"
						});
				  });
	  }
	  
	  
	  
	  function createData(data){
		  var content = [];
		  for(var i =0 ;i < data.length;i++){
			  var cr = data[i];
			  content.push('<tr>');
			  content.push('<td>'+(i+1)+'</td>');
			  content.push('<td>'+cr.caseName+'</td>');
			  content.push('<td>'+cr.caseNo+'</td>');
			  content.push('<td>'+cr.brand+'</td>');
			  content.push('<td>'+cr.model+'</td>');
			  content.push('<td>'+cr.version+'</td>');
			  content.push('<td>'+showStr(runStatus[cr.runStatus])+'</td>');
			  content.push(' <td class="td-manage"> '+
		                '<a title="查看"  onclick="x_admin_show(\'查看\',\'../caseRun/toresult?json='+encodeURIComponent(JSON.stringify(cr))+'\',null,null,true)" href="javascript:;">'+
		                  '<i class="layui-icon">&#xe65f;</i>'+
		                '</a>'+
		            '</td>'); 
			  content.push('</tr>');
		  }
		  
		  $("#dg").empty().append(content.join(""));
	  }
	  
	  
	  
	  
});